package com.gu.domain.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;
import java.util.Objects;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

/**
 * @TableName sg_article
 */
@TableName(value ="sg_article")
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class Article {
    private Long id;

    private String title;

    private String content;

    private String summary;

    private Long categoryId;

    @TableField(exist=false)
    private String categoryName;

    private String thumbnail;

    private String isTop;

    private String status;

    private Long viewCount;

    private String isComment;

    private Long createBy;

    private Date createTime;

    private Long updateBy;

    private Date updateTime;

    private Integer delFlag;

    public Article(Long id, long viewCount) {
        this.id = id;
        this.viewCount = viewCount;
    }


    @Override
    public boolean equals(Object o) {
        if (o == null || getClass() != o.getClass()) return false;
        Article article = (Article) o;
        return Objects.equals(id, article.id) && Objects.equals(title, article.title) && Objects.equals(content, article.content) && Objects.equals(summary, article.summary) && Objects.equals(categoryId, article.categoryId) && Objects.equals(categoryName, article.categoryName) && Objects.equals(thumbnail, article.thumbnail) && Objects.equals(isTop, article.isTop) && Objects.equals(status, article.status) && Objects.equals(viewCount, article.viewCount) && Objects.equals(isComment, article.isComment) && Objects.equals(createBy, article.createBy) && Objects.equals(createTime, article.createTime) && Objects.equals(updateBy, article.updateBy) && Objects.equals(updateTime, article.updateTime) && Objects.equals(delFlag, article.delFlag);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, title, content, summary, categoryId, categoryName, thumbnail, isTop, status, viewCount, isComment, createBy, createTime, updateBy, updateTime, delFlag);
    }

}